home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 May: Tool Chest / Dev.CD May 97 TC.toast / Sample Code / Toolbox / MacCalendar 1.1b1 / DrawCalendar.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-03-20  |  2.2 KB  |  71 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        DrawCalendar.h
  3.  
  4.     Contains:    Module for displaying the calendar (Gregorian).
  5.  
  6.     Written by:    Martin Minow
  7.  
  8.     Copyright:    © 1994-1997 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.     You may incorporate this sample code into your applications without
  13.     restriction, though the sample code has been provided "AS IS" and the
  14.     responsibility for its operation is 100% yours.  However, what you are
  15.     not permitted to do is to redistribute the source as "DSC Sample Code"
  16.     after having made changes. If you're going to re-distribute the source,
  17.     we require that you make it clear in the source that the code was
  18.     descended from Apple Sample Code, but that you've made changes.
  19.  
  20.     DrawCalendar displays the calendar (Gregorian) for the selected date. The
  21.     algorithm has been simplified and consequently will only work for dates within
  22.     the Macintosh epoch.
  23.  
  24.     Note that DrawCalendar is common to the Control Strip and Setup application.
  25.     If you change it, you must rebuild both modules.
  26. */
  27.  
  28. #ifndef __DRAWCALENDAR__
  29. #define __DRAWCALENDAR__
  30.  
  31. #include "MacCalendarCommon.h"
  32.  
  33. #include <Types.h>
  34.  
  35. /*
  36.  * These functions are defined in DrawCalendar.c. They are not specific to
  37.  * the Status Bar module interface.
  38.  */
  39.  
  40. /*
  41.  * DrawCalendar draws the current calendar in the current port in the specified
  42.  * display area.
  43.  */
  44. void                        DrawCalendar(
  45.         SavedSettingsHandle        settings,        /* Current font etc            */
  46.         short                    year,            /* 1904 ..                    */
  47.         short                    month,            /* January == 1                */
  48.         const Rect                *displayRect    /* Where to draw the text    */
  49.     );
  50.  
  51. /*
  52.  * GetCalendarDisplaySize returns the size of the calendar if it is to be drawn
  53.  * in the specified fontNumber and fontSize.
  54.  */
  55. Point                        GetCalendarDisplaySize(
  56.         SavedSettingsHandle        settings        /* Current font etc            */
  57.     );
  58.  
  59. /*
  60.  * GetCalendarMonthRect uses the fontNumber and fontSize to compute the size
  61.  * size of the calendar as it will be drawn. Then the function creates an
  62.  * actual display rectangle that is centered in the specified displayRect.
  63.  */
  64. void                        GetCalendarMonthRect(
  65.         SavedSettingsHandle        settings,        /* Current font etc            */
  66.         const Rect                *displayRect,    /* Where to draw the text    */
  67.         Rect                    *monthRect        /* Returns drawing rect        */
  68.     );
  69.  
  70. #endif /* __DRAWCALENDAR__ */
  71.